<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <%--  <script type=""--%>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="css/common.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrap">
    <!-- main begin-->
    <div class="sale">
        <h1 class="lf">在线拍卖系统</h1>
        <div class="logout right"><a href="#" title="注销">注销</a></div>
    </div>
    <div class="forms">
        <label for="name">名称</label>
        <input name="" type="text" class="nwinput" id="name"/>
        <label for="names">描述</label>
        <input name="" type="text" id="names" class="nwinput"/>
        <label for="time">开始时间</label>
        <input name="" type="text" id="time" class="nwinput"/>
        <label for="end-time">结束时间</label>
        <input name="" type="text" id="end-time" class="nwinput" />
        <label for="price">起拍价</label>
        <input name="" type="text" id="price" class="nwinput" />
        <input name="auctionName" id="auctionName" type="button"  value="查询" class="spbg buttombg f14  sale-buttom" onclick="Select()"/>
        <input type="button"  value="发布" class="spbg buttombg f14  sale-buttom buttomb" onclick="add()"/>
    </div>
    <div class="items">
        <ul class="rows even strong">
            <li>名称</li>
            <li class="list-wd">描述</li>
            <li>开始时间</li>
            <li>结束时间</li>
            <li>起拍价</li>
            <li class="borderno">操作</li>
        </ul>
        <c:forEach items="${requestScope.list}" var="auction">
            <ul class="rows">
                <li><a href="国书" title="">${auction.auctionName}</a></li>
                <li class="list-wd">${auction.auctionDesc}</li>
                <li>${auction.auctionStartTime}</li>
                <li>${auction.auctionEndTime}</li>
                <li>${auction.auctionStartPrice}</li>
                <li class="borderno red">
                    <a href="ByIdServlet?id=${auction.auctionId}" title="竞拍">修改</a>|
                    <a href="javascript:void (0)" onclick="del(this,${auction.auctionId})" title="竞拍" >删除</a>
                </li>
            </ul>
        </c:forEach>
        <div class="page">
            <a href="#" title="">首页</a>
            <a href="#" title="">上一页</a>
            <span class="red">前5页</span>
            <a href="#" title="">1</a>
            <a href="#" title="">2</a>
            <a href="#" title="">3</a>
            <a href="#" title="">4</a>
            <a href="#" title="">5</a>
            <a href="#" title="">下一页</a>
            <a href="#" title="">尾页</a>
        </div>
    </div>
    <!-- main end-->
</div>
</body>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script>
    function del(tmp,auctionId) {
        var ret=confirm("确定要删除吗？");
        if (ret){
            $.ajax({
                url:"deleteServlet?auctionId="+auctionId,
                type:"get",
                success:function (data) {
                    if (data>0){
                        alert("删除成功");
                        $(tmp).parent().parent().remove();
                    }
                }
            })
        }
    }
    function Select() {
        var auctionName=$("#auctionName").val();
        $.ajax({
            url:"selectLikeServlet?auctionName="+auctionName,
            type:"get",
            dataType:"json",
            success:function (data) {
                if (data>0){
                    alert("asd");
                    alert("查询成功");
                }
            }
        })
    }
    function add() {
        location.href="add.jsp";
    }
</script>
</html>
